package com.maiworld.content.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.maiworld.content.service.CommentService;
import com.maiworld.mapper.CommentMapper;
import com.maiworld.pojo.Comment;

import entity.PageResult;
@Service
public class CommentServiceImpl implements CommentService{

	@Autowired
	private CommentMapper commentMapper;
	
	
	@Override
	public PageResult selectByComment(Comment comment,int page,int rows) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page, rows);
		Page<Comment> pageList = (Page<Comment>)commentMapper.selectByComment(comment);
		return new PageResult(pageList.getTotal(), pageList.getResult());
	}


	@Override
	public int deleteByIdArray(Long[] idArray) {
		// TODO Auto-generated method stub
		return commentMapper.deleteByIdArray(idArray);
	}


	@Override
	public Integer addComment(Comment comment) {
		// TODO Auto-generated method stub
		Integer row = commentMapper.addComment(comment);
		return Integer.parseInt(comment.getId().toString());
	}


	@Override
	public List<Comment> selectCommmentsByAid(Comment comment) {
		// TODO Auto-generated method stub
		return commentMapper.selectByComment(comment);
	}


	@Override
	public Comment selectCommentById(Long id, String status) {
		// TODO Auto-generated method stub
		return commentMapper.selectCommentById(id, status);
	}




}
